PROGRAMS=mysh1 mysh2 mysh3 syn1 syn2 synthread1 synthread2 question6 
OBJECTS=common.o
CC=gcc
LINKER=gcc
OPTS=-Wall
SOURCE=source

all: $(PROGRAMS) java

package:
	tar -cf marek.kirejczyk.tar source syn Makefile documentation.txt *.sh

mysh1: mysh1.o common.o
	$(LINKER) $(OPTS) $^ -o $@

mysh2: mysh2.o common.o
	$(LINKER) $(OPTS) $^ -o $@

mysh3: mysh3.o common.o
	$(LINKER) $(OPTS) $^ -o $@

syn1: syn1.o
	$(LINKER) $(OPTS) $^ -o $@

syn2: syn2.o
	$(LINKER) $(OPTS) $^ -o $@

synthread1: synthread1.o
	$(LINKER) -lpthread $(OPTS) $^ -o $@

synthread2: synthread2.o
	$(LINKER) -lpthread $(OPTS) $^ -o $@

question6: question6.o
	$(LINKER) -lpthread $(OPTS) $^ -o $@

java:
	javac syn/*.java

clean:
	rm -f $(PROGRAMS) *.o syn/*.class

%.o: $(SOURCE)/%.c
	$(CC) $(OPTS) -c $^ -o $@

